import { useState } from 'react';

// 自定义hooks内可以使用其它的hooks函数
export default function useMouse() {
  const [mouse, setMouse] = useState({ x: 0, y: 0 });
  const handleMouseMove = (e) => {
    setMouse({ x: e.clientX, y: e.clientY });
  };

  return {
    mouse,
    handleMouseMove,
  };
}
